<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/CMS.Master" Inherits="Shop.Framework.Page.OrdersPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    <title>Orders</title>
    <style type="text/css">
        #wrapper
        {
            width: 644px;
            margin: 0 auto;
            background-color: #DFF7F4;
            border: solid 2px #C2D1CF;
            font-size:12px;
        }
        #orderList
        {
            width:450px;
            margin: 0 auto;
            padding: 15;
            background-color: #DFF7F4;
            border: solid 2px #C2D1CF;
        }#orderList li{            
            list-style:none;
            padding:15;
            margin:0;
            height:auto;
        }
        #orderList li div.holder{  
            padding:10px;
            }
        .label
        {
            width: 110px;
            padding-left:10px;
        }
        .inputs
        {
            width: 150px;
        }
        
         .label2
        {
            width: 200px;
        }
    </style>
    <script type="text/javascript" language="javascript">
        $(document).ready(function() {
            $("input[name='dateFrom']").datepicker();
            $("input[name='dateTo']").datepicker();
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div style="padding-top:100px;"></div>
    <div id="wrapper">
        <center><h2>Order Listing: (Total Sale For the current list: <%=TotalSale.ToString("c") %>)</h2></center>
        <div>
            <form action="/cms/orders" method="post">
            <div>
                <div class="left label">
                    Filter Date From:
                </div>
                <div class="left">
                    <input type="text" name="dateFrom" class="inputs"/>
                </div>
            </div>
            <div class="left">
                <div class="left label">
                    Filter Date To:
                </div>
                <div class="left">
                    <input type="text" name="dateTo" class="inputs"/>
                </div>
            </div>
            <div class="left" style="padding-left:5px">
                <input type="submit" value="Filter" />
            </div>
            <div class="clear"></div>
            </form>
        </div>
        <div style="padding-top:50px;"></div>
        <div style="height:700px;overflow:scroll">
            <center><b><%=Label %></b></center>
            <div style="padding-top:25px;"></div>
            <%if (CustomerOrders != null && CustomerOrders.Count != 0) { %>
            <ul id="orderList">
                <%foreach (var t in CustomerOrders) { %>
                    <li>
                        <div class="holder">
                            <div><b>Order Number: </b><%=t.IdCustomerOrder %></div>
                            <div><b>Customer: </b><%=t.Customer.FirstName %> <%=t.Customer.LastName %></div>                            
                            <div><b>Order Status:</b>
                                <%if (t.Completed == null ? false: t.Completed.Value) { %>                            
                                    Completed
                                <%} else { %>
                                    For Delivery / Pickup
                                <%} %>
                            </div>
                            <div>
                                <a href="/cms/orders/<%=t.IdCustomerOrder %>.html">View Detail..</a>
                            </div>
                         </div>
                         <%if (!(t.Completed == null ? false : t.Completed.Value)) { %>
                         <div>
                            <form action="/cms/complete-order" method="get">                            
                            <input type="submit" value="Set order as completed.."/>                            
                            <input type="hidden" value="<%=t.IdCustomerOrder %>" name="IdCustomer"/>
                            </form>                                                                                 
                         </div>                         
                         <%} %>    
                         <hr />                   
                    </li>
                <%} %>
            </ul>
            <%} else {%>
            <center><b>No orders found</b></center>
            <%} %>
        </div>
        <div style="padding-top:25px;"></div>
    </div>
</asp:Content>
